package com.ihd.ihardware.view.tzc.health.viewmodel;

import android.app.Application;
import android.arch.lifecycle.AndroidViewModel;
import android.support.annotation.NonNull;

import com.ihd.ihardware.view.tzc.health.model.ReportRepository;

public class MeasureViewModel extends AndroidViewModel {

    private ReportRepository mReportRepository;

    public MeasureViewModel(@NonNull Application application) {
        super(application);
    }


    public void weighing(String familyId, String originalData) {
        if (mReportRepository == null)
            mReportRepository = new ReportRepository();
        mReportRepository.weighing(familyId, originalData);
    }

    @Override
    protected void onCleared() {
        super.onCleared();
        if (null != mReportRepository) {
            mReportRepository.onDestroy();
            mReportRepository = null;
        }
    }
}
